package com.zj.z11select.exception;

import com.zj.z11select.constant.HttpStatus;

/**
 * 自定义异常类
 * @author Duanyu
 * @date 2021-09-24 15:16
 */
public class CustomException extends RuntimeException{

    private int code;

    public CustomException(int code){
        this.code = code;
    }

    public CustomException(String message){
        super(message);
        this.code = HttpStatus.ERROR;
    }

    public CustomException(int code,String message){
        super(message);
        this.code = code;
    }

    public CustomException (int code, String message, Throwable cause) {
        super(message, cause);
        this.code = code;
    }

    public CustomException (int code, Throwable cause) {
        super(cause);
        this.code = code;
    }

    public CustomException (int code, String message, Throwable cause, boolean enableSuppression,
                         boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.code = code;
    }

    public int getCode(){
        return this.code;
    }

}
